#!/bin/sh
#
#    Copyright (c) 2003-2004 Brocade Communications Systems, Inc.
#    All rights reserved.
#
#    File name:	prominst_athena
#
#    The script will install prom package for Athena and Pulsar. 
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin

OK=0
echo "Please avoid powering off the system during prom update."
for i in `seq 3`; do
        nohup /sbin/flash_write -i /boot/bootrom.bin \
		-o /dev/prom0 >/dev/null 2>&1

        if [ $? -eq 0 ]; then
        	nohup /sbin/flash_write -i /boot/bootrom.bin \
			-o /dev/prom1 >/dev/null 2>&1

        	if [ $? -eq 0 ]; then
        		OK=1	
			break;
		fi
	fi
done

if [ $OK -ne 1 ]; then
        echo "Failed to write to prom partition!"
        exit 1
fi
